display product page title in field cf7

61

wpcf7_add_shortcode( 'cf7_extra_fields', 'cf7_extra_fields_func', true );
function cf7_extra_fields_func( $atts ) {
   $html = '';
   $html .= '<input type="hidden" name="page-title" value="'.get_the_title().'" />';
   $html .= '<input type="hidden" name="page-url" value="'.get_the_permalink().'" />';
   return $html;
}

Comments

Submit
0 Comments